#include "SelectSort.h"
#include "CommonLib.h"

void SelectSort(int ary[], int size)
{
    for (int i = 0; i < size - 1; ++i)
    {
        int minIndex = i;
        for (int j = i + 1; j < size; ++j)
        {
            if (ary[j] < ary[minIndex])
            {
                minIndex = j;
            }
        }

        if (minIndex != i)
        {
            CCommonLib::Exchange(ary[i], ary[minIndex]);
        }
    }
}